<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        window.addEventListener('load',function () {
            var div = document.querySelector('div');
            window.addEventListener('resize',function () {
                if (window.innerWidth < 500) {
                    div.style.display = 'none';
                }else {
                    div.style.display = 'block';
                }
            })
        })
    </script>
</head>
<style>
    div{
        width: 150px;
        height: 150px;
        background: tomato;
    }
</style>
<body>
<div>

</div>
</body>
</html>